<template>
	<view>
		<u-search placeholder="请输入安全宣传名称" v-model="keyword" @search="searchnews()"></u-search>
		<view class="newstop">
			<u-row>
				<u-col span="3">
					<p style="font-size: 35rpx;font-weight: 700;margin-top: -20rpx;">{{listname}}</p>
				</u-col>
			</u-row>
		</view>
		<view>
			<scroll-view scroll-y style="width: 100%;" @scrolltolower="onreachBottom">
				<view class="item">
					<view class="wrap">
						<u-row gutter="16" justify="space-between" v-for="(item,i) in news">
							<u-col span="3" @click="gonews(item.id)">
								<img :src="item.safetyPublicityPic" mode="aspectFill" style="width: 200rpx;height: 200rpx;"></img>
							</u-col>
							<u-col span="9" @click="gonews(item.id)">
								<view class="newsname">{{ item.safetyPublicityTitle }}</view>
								<view class="newstime">{{ item.setDate }}</view>
							</u-col>
						</u-row>
					</view>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				listid: '',
				listname:'',
				keyword: '',
				/* 数据 */
				news: [],
			}
		},
		onLoad: function(option) {
			this.listid = option.listNumber
			this.listname = option.listName
			this.$u.api.selectpublictime({
				safetyPublicityType: this.listid
			}).then(res => {
				this.news = res.rows;
			})
		},
		computed: {},
		onShow() {},
		created() {

		},
		methods: {
			openPage(path) {
				this.$u.route({
					url: path
				})
			},

			gonews(num) {
				uni.navigateTo({
					url: '/pages/propaganda/content?newsNumber=' + num,
				})
			},
			searchnews(){
				console.log(this.keyword)
				debugger
				this.$u.api.selectpublictime({
					safetyPublicityType: this.listid,
					safetyPublicityTitle:this.keyword,
				}).then(res => {
					debugger
					this.news = res.rows;
					console.log(this.news);
				})
			}
		}
	}
</script>

<style>
	.item {
		margin: 30rpx 0;
	}

	.wrap {
		/* display: flex; */
		flex-direction: column;
		height: calc(100vh - var(--window-top));
		width: 100%;
	}

	/* 数据 */

	.u-row {
		margin: 40rpx 0;
	}

	.demo-layout {
		height: 80rpx;
		border-radius: 8rpx;
	}

	.bg-purple {
		background: #d3dce6;
	}

	.bg-purple-light {
		background: #e5e9f2;
	}

	.bg-purple-dark {
		background: #99a9bf;
	}

	.newsname {
		font-size: 35rpx;
		margin-top: 30rpx;
		margin-left: 50rpx;
		font-weight: 700;
	}

	.newstime {
		font-size: 30rpx;
		margin-top: 30rpx;
		margin-left: 50rpx;
		color: #7f7f93;
	}

	.newstop {
		border: 1px solid #dde3ed;
		height: 80rpx;
	}
</style>
